package com.wysql.ascost.service.info;

import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wysql.ascost.common.base.BaseService;
import com.wysql.ascost.common.support.ConvertUtil;
import com.wysql.ascost.mapper.info.InfoImportresultMapper;
import com.wysql.ascost.model.custom.Tablepar;
import com.wysql.ascost.model.info.InfoImportresult;
import com.wysql.ascost.model.info.InfoImportresultExample;
import com.wysql.ascost.util.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 导入操作台账 InfoImportresultService
 * @Title: InfoImportresultService.java 
 * @Package com.wysql.ascost.service 
 * @author wysqlauto_自动生成
 * @email ${email}
 * @date 2025-02-25 10:51:34  
 **/
@Service
public class InfoImportresultService implements BaseService<InfoImportresult, InfoImportresultExample> {
    @Autowired
    private InfoImportresultMapper infoImportresultMapper;

                                                                                                    
    /**
     * 分页查询
     * @param
     * @param
     * @return
     */
    public PageInfo<InfoImportresult> list(Tablepar tablepar,InfoImportresult infoImportresult) {
            InfoImportresultExample testExample = new InfoImportresultExample();
        //搜索
        if (StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
            testExample.createCriteria().andLikeQuery2(tablepar.getSearchText());
        } else {//大搜索
            testExample.createCriteria().andLikeQuery(infoImportresult);
        }
        //表格排序
        //if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
        //	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
        //}else{
        //	testExample.setOrderByClause("id ASC");
        //}
        PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
        List<InfoImportresult> list = infoImportresultMapper.selectByExample(testExample);
        PageInfo<InfoImportresult> pageInfo = new PageInfo<InfoImportresult>(list);
        return pageInfo;
    }
    
        @Override
        public int deleteByPrimaryKey(String ids) {
            
                List<String> lista = ConvertUtil.toListStrArray(ids);
                    InfoImportresultExample example = new InfoImportresultExample();
                example.createCriteria().andIdIn(lista);
                return infoImportresultMapper.deleteByExample(example);

            
        }


        @Override
        public InfoImportresult selectByPrimaryKey(String id) {
            
                return infoImportresultMapper.selectByPrimaryKey(id);
            
        }


        @Override
        public int updateByPrimaryKeySelective(InfoImportresult record) {
            return infoImportresultMapper.updateByPrimaryKeySelective(record);
        }

    
    /**
     * 添加
     */
    @Override
    public int insertSelective(InfoImportresult record) {
        
            //添加雪花主键id
            record.setId(SnowflakeIdWorker.getUUID());

        
        return infoImportresultMapper.insertSelective(record);
    }


    @Override
    public int updateByExampleSelective(InfoImportresult record, InfoImportresultExample example) {

        return infoImportresultMapper.updateByExampleSelective(record, example);
    }


    @Override
    public int updateByExample(InfoImportresult record, InfoImportresultExample example) {

        return infoImportresultMapper.updateByExample(record, example);
    }

    @Override
    public List<InfoImportresult> selectByExample(InfoImportresultExample example) {

        return infoImportresultMapper.selectByExample(example);
    }


    @Override
    public long countByExample(InfoImportresultExample example) {

        return infoImportresultMapper.countByExample(example);
    }


    @Override
    public int deleteByExample(InfoImportresultExample example) {

        return infoImportresultMapper.deleteByExample(example);
    }


}
